package com.badshun.ui;

import com.badlogic.gdx.scenes.scene2d.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.*;
import com.badlogic.gdx.scenes.scene2d.ui.*;

public class TalkBox {
	private Texture background;
	private Texture playerHeadImage;
	private BitmapFont font;
	
	private String playerName;
	private String content;
	
	private SpriteBatch spriteBatch;
	
	public TalkBox(Texture playerHeadImage,String playerName,String content) {
		this.playerHeadImage = playerHeadImage;
		this.playerName = playerName;
		this.content = content;
		
		background = new Texture(Gdx.files.internal("ui/talkbox.png"));
		font = new BitmapFont(Gdx.files.internal("font/font.fnt"),new TextureRegion(new Texture(Gdx.files.internal("font/font.png"))));
		
		spriteBatch = new SpriteBatch();
	}
	
	public void render() {
		spriteBatch.begin();
		spriteBatch.draw(background,0,Gdx.graphics.getHeight() * 3 / 4,Gdx.graphics.getWidth(),Gdx.graphics.getHeight() / 4);
		spriteBatch.draw(playerHeadImage,0,Gdx.graphics.getHeight() * 3 / 4,Gdx.graphics.getHeight() / 4 - Gdx.graphics.getHeight() / 16,Gdx.graphics.getHeight() / 4 - Gdx.graphics.getHeight() / 16);
		font.draw(spriteBatch,playerName + ":",0,Gdx.graphics.getHeight());
		font.draw(spriteBatch,content,Gdx.graphics.getHeight() / 4 - Gdx.graphics.getHeight() / 16,Gdx.graphics.getHeight() - Gdx.graphics.getHeight() / 16);
		spriteBatch.end();
	}
}
